<template>
	<div class="income-container">
	<div class="income-icon"><span class="income-icon-text">￥</span></div>
	<div class="icome-text">我的账户收入</div>
	<div class="icome-num">￥{{income}}</div>
	<div style="width: 80%; margin: 15px auto 0px auto;" class="btn-wrap">

		<i-button type="success">充值</i-button>
    	<i-button type="warning">提现</i-button>
	</div>
	<router-link to="applyhistory" class="icome-qaq">申请记录</router-link>
	<router-link to="/pages/help/list/index" class="icome-qaq">常见问题</router-link>
	</div>
</template>

<script>

	export default {
	  data() {
	  	return {
	   		income: 0,
	  	}
	  },
	  created (){
	    App.login().then(data => {

	            App.checkRetail()
	            
	      this.getPurseDetail()
	    })
	  },
	  methods: {
	  	bindHistory() {
	        App.WxService.navigateTo('/pages/income/history',)
	    },
	    bindWithDraw(){

	      let that = this
	      App.WxNotificationCenter.addNotification("refreshMoneyNotification", that.refresh, that)
	       App.WxService.navigateTo('/pages/income/withdraw',)
	    },
	    getPurseDetail(){
	      wx.showNavigationBarLoading()
	      App.HttpService.getIncomeDetail().then(data => {
	        wx.hideNavigationBarLoading()
	        if(!App.Tools.isEmptyObject(data))
	          this.setData({income: parseFloat(data.income)})
	      })
	    },

	    refresh(){
	      this.onPullDownRefresh()
	    },

	    onPullDownRefresh(){
	      this.getPurseDetail();
	    }
	  }
	}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
	button
		font-size: 14px
	.btn-wrap
		button
			width: 100%
			height: 40px
			line-heigth: 38px
			box-sizing: border-box
			border: 1px solid #FFF
			margin-bottom: 8px
	.income-container
		position: absolute
		top: 0
		bottom: 0
		right: 0
		left: 0

	.income-icon
		background-color: #e8cc12
		width: 100px
		height: 100px
		margin: 0 auto
		border-radius: 50%
		display: flex
		align-items: center
		justify-content: center
		margin-top: 30px


	.withdram-btm
		background-color: #ad0e11
		color: #fff

	.income-icon-text
		border:2px solid #fff
		border-radius: 50%
		font-size: 64px
		height: 80px
		width: 80px
		line-height: 80px
		text-align: center
		color: #fff
		display: block

	.icome-qaq
		display: block
		margin-top: 10px
		line-height:28px
		text-align: center
		color: #007bba
		font-size: 14px

	.icome-text
		text-align: center
		line-height: 32px
		font-size: 16px
		padding: 10px 0
		letter-spacing: 1px

	.icome-num
		text-align: center
		color: #3e3e3e
		font-weight: 500
		font-size: 24px
		line-height: 40px
</style>